//
//  XLWebManager.m
//  campus
//
//  Created by xl on 2020/1/2.
//  Copyright © 2020 xl. All rights reserved.
//

#import "XLWebManager.h"
#import "UIDevice+XL.h"

@implementation XLWebManager

+ (void)requestOpenWebUrlPath:(NSString *)path queryString:(NSString *)queryString{
    NSString *paramStr = [NSString string];
//    if (!ISEmptyString(queryString)) {
//        paramStr = [NSString stringWithFormat:@"accessToken=%@&refreshToken=%@&%@&xAdapt=%@&%@",[XLKeyChainDefault getCurrentAppAccessToken], [XLKeyChainDefault getCurrentAppRefreshToken], [self followMessage], @(IS_ABOVE_IPHONE_X), queryString];
//    } else {
//        paramStr = [NSString stringWithFormat:@"accessToken=%@&refreshToken=%@&%@&xAdapt=%@",[XLKeyChainDefault getCurrentAppAccessToken], [XLKeyChainDefault getCurrentAppRefreshToken], [self followMessage], @(IS_ABOVE_IPHONE_X)];
//    }
//    NSData *followData = [paramStr dataUsingEncoding:NSUTF8StringEncoding];
//
//    NSString *url = [NSString stringWithFormat:@"%@%@?params=%@",XLServerHttpDomain, path, [followData base64EncodedStringWithOptions:0]];
//    [[MPNebulaAdapterInterface shareInstance] startH5ViewControllerWithParams:@{@"url": url}];
}


+ (void)requestWebNoTokenPath:(NSString *)path title:(NSString *)title {
    //TODO暂时用以前的域名
//    NSString *url = [NSString stringWithFormat:@"%@%@",XLServerWebDomain,path];
//    if (ISEmptyString(title)) {
//        [[MPNebulaAdapterInterface shareInstance] startH5ViewControllerWithParams:@{@"url": url, @"so":@(NO), @"rt":@(NO)}];
//    } else {
//        [[MPNebulaAdapterInterface shareInstance] startH5ViewControllerWithParams:@{@"url": url, @"dt":title, @"so":@(NO), @"rt":@(NO)}];
//    }
}

+ (void)requestOPenWebUrl:(NSString *)url title:(NSString *)title {
    if (ISEmptyString(url)) {
        return;
    }
    if (ISEmptyString(title)) {
        [[MPNebulaAdapterInterface shareInstance] startH5ViewControllerWithParams:@{@"url": url, @"so":@(NO), @"rt":@(NO)}];
    } else {
        [[MPNebulaAdapterInterface shareInstance] startH5ViewControllerWithParams:@{@"url": url, @"dt":title, @"so":@(NO), @"rt":@(NO)}];
    }
}

+ (NSString *)followMessage {
    //机器类型：iPhone
//    NSString * brand = [[UIDevice currentDevice] model];
//    NSString *model = [UIDevice currentDevice].machineType;
//    //手机系统版本：11.1.2
//    NSString* systemVersion = [[UIDevice currentDevice] systemVersion];
//    // app版本
//    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
//    NSString *appVersion = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
//    NSString *followStr = [NSString stringWithFormat:@"brand=%@&platform=%@&model=%@&version=%@&appVersion=%@&mobile=%@", brand, @(1), model, systemVersion, appVersion, _UserData.mobile];
//    return followStr;
    return nil;
}
@end
